using System;
using System.Collections.Generic;
using System.Text;

namespace Coriander.Xmpp.Xmpp
{
    /// <summary>
    /// When in async listen mode, this type is responsible for routing events to handlers.
    /// </summary>
    /// <remarks>
    /// How is that done?
    /// 1. Connection must expose an event for every read, not just completed reads
    /// 2. Another object then interprets each response, building a response node.
    /// 3. Once the node is complete, an EventDispatcher routes the node to any listeners
    ///    that subscribe to the node or pattern.
    /// 
    /// TODO: For item (2), add an object that does this - interprets a stream, inspecting for
    /// completed nodes.
    /// </remarks>
    public abstract class EventDispatcher
    {
        /// <summary>
        /// Attaches a delegate to a pattern.
        /// </summary>
        /// <param name="pattern"></param>
        /// <param name="callback"></param>
        protected abstract void AddListenerCore(String pattern, Delegate callback);
    }
}
